# _*_ coding: utf-8 _*_
# @Time : 2021/3/31 0031 1:57
# @Author : 夕木酱
import xlrd
from config.conf import cm


class ValueExcels:
    caseID = 0
    des = 1
    url = 2
    method = 3
    data = 4
    expect = 5

    def CaseID(self):
        return self.caseID

    def description(self):
        return self.des

    def Url(self):
        return self.url

    def Method(self):
        return self.method

    def Data(self):
        return self.data

    def Expect(self):
        return self.expect


class OperationExcel():
    # valueExcels = ValueExcels()

    def get_excel(self):
        '''打开Excel文件'''
        db = xlrd.open_workbook(cm.DATA_PATH(filename='data.xls'))
        sheet = db.sheet_by_index(0)
        return sheet

    def get_row(self):
        '''获取Excel有多少行内容'''
        return self.get_excel().nrows

    def getValue(self, row, cel):
        return self.get_excel().cell_value(row, cel)

    def getCaseID(self, row):
        '''获取caseid列'''
        return self.getValue(row, ValueExcels().CaseID())

    def getURL(self, row):
        return self.getValue(row, ValueExcels().Url())

    def getdata(self, row):
        return self.getValue(row, ValueExcels().Data())

    def getmethod(self, row):
        return self.getValue(row, ValueExcels().Method())


o = OperationExcel()
# print(o.getValue(1,ValueExcels().Url()))
print(o.getCaseID(1))
print(o.getURL(1))
print(o.getdata(1))
print(o.getmethod(1))